package model

import "github.com/fakeyanss/jt808-server-go/internal/codec/hex"

type Msg9102Param struct {
	ChannelNo   uint8 // 通道编号，4-6
	Command     uint8 // 控制指令，0为关闭音视频传输
	CommandType uint8 // 关闭音视频类型，0为关闭该通道的音视频
	FlowType    uint8 // 切换码流类型
}

// Msg9102 音视频传输控制
type Msg9102 struct {
	Header *MsgHeader `json:"header"`
	Msg9102Param
}

func (m *Msg9102) Decode(packet *PacketData) error {
	return nil
}

func (m *Msg9102) Encode() (pkt []byte, err error) {
	pkt = hex.WriteByte(pkt, m.ChannelNo)
	pkt = hex.WriteByte(pkt, m.Command)
	pkt = hex.WriteByte(pkt, m.CommandType)
	pkt = hex.WriteByte(pkt, m.FlowType)

	pkt, err = writeHeader(m, pkt)
	return pkt, err
}

func (m *Msg9102) GetHeader() *MsgHeader {
	return m.Header
}

func (m *Msg9102) GenOutgoing(incoming JT808Msg) error {
	return nil
}
